import objectUtils from "@/utils/object/index.js";

export default objectUtils.freeze({
	mobile: function(phone = "") {
		const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
		return reg.test(phone);
	},
	amount: function(amount = "") {
		if(/^\d+$/.test(amount)){
			if(amount > 0){
				return true;
			}else{
				return false;
			}
		}else{
			if(/^\d+(\.\d{1,2})?$/.test(amount)){
				let decimalPoint = amount.match(/\./g);
				if(decimalPoint){
					return decimalPoint.length === 1;
				}else{
					return false;
				}
			}else{
				return false;
			}
		}
	}
});